import { inject, provide, ref, Ref } from "vue"
import { ItemDefination } from "./types"

export const collapsibleFormContextKey = Symbol("collapsibleFormContextKey")

export function useProvideCollapsisbleFormContext(context: any) {
  provide(collapsibleFormContextKey, context)
}

export function useInjectCollapsibleFormContext() {
  return inject<Ref<ItemDefination[]>>(collapsibleFormContextKey, ref([]))
}
